#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_GLYPH_H

void myDrawDevice(FT_Bitmap* bitmap, int x, int y);

int main() {
    FT_Library library;
    FT_Face face;
    FT_GlyphSlot slot;
    FT_Glyph glyph;
    int penX = 300;
    int penY = 300;

    int error = FT_Init_FreeType(&library);
    if (error) {
        printf("freetype init error!(errorcode:%d)\n", error);
        return error;
    }
    
    error = FT_New_Face(library, "./Tfont1212c_T1C.otf", 0, &face);
    if (FT_Err_Unknown_File_Format == error) {
        printf("format unkown");
        return error;
    }
    else if (error) {
        printf("cann't read font file");
        return error;
    }

    printf("glyphs num: %d\n", (int)face->num_glyphs);
    error = FT_Set_Char_Size(face, 0, 16*64, 300, 300);
    if (error) {
        printf("set char size failed!\n");
    }
   
    error = FT_Load_Char(face, 'A', FT_LOAD_RENDER);
    if (error) {
        printf("load char failed!\n");
    }
    
    slot = face->glyph;
    myDrawDevice(&slot->bitmap, penX + slot->bitmap_left, penY - slot->bitmap_top);

    return 0;
}

void myDrawDevice(FT_Bitmap* bitmap, int x, int y)
{
}

//Tfont1212c_T1BC.otf
//Tfont1212c_T1C.otf
